﻿<navigation:Page
    x:Class="TheOliver.DigitalSignage.Admin.Views.Speaker"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    d:DesignWidth="640"
    d:DesignHeight="480"
    Title="Speaker Page"
    xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Ria"
    xmlns:my="clr-namespace:Web.Services"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit">

    <controlsToolkit:BusyIndicator
        IsBusy="{Binding ElementName=speakerDomainDataSource, Path=DomainContext.IsLoading}">
        <Grid
            x:Name="LayoutRoot">
            <Grid.RowDefinitions>
                <RowDefinition
                    Height="0.5*" />
                <RowDefinition
                    Height="0.5*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition
                    Width="0.5*" />
                <ColumnDefinition
                    Width="0.5*" />
            </Grid.ColumnDefinitions>
            <riaControls:DomainDataSource
                AutoLoad="True"
                Height="0"
                LoadedData="speakerDomainDataSource_LoadedData"
                Name="speakerDomainDataSource"
                QueryName="GetSpeakerQuery"
                Width="0"
                Margin="0,12,0,240"
                Grid.Column="1"
                Grid.Row="1"
                d:LayoutOverrides="GridBox">
                <riaControls:DomainDataSource.DomainContext>
                    <my:DigitalSignageDomainContext />
                </riaControls:DomainDataSource.DomainContext>
            </riaControls:DomainDataSource>
            <data:DataGrid
                AutoGenerateColumns="False"
                HorizontalAlignment="Stretch"
                ItemsSource="{Binding ElementName=speakerDomainDataSource, Path=Data}"
                Margin="0,0,0,28"
                Name="speakerDataGrid"
                RowDetailsVisibilityMode="VisibleWhenSelected"
                Grid.ColumnSpan="2">
                <data:DataGrid.Columns>

                    <data:DataGridTextColumn
                        x:Name="firstnameColumn"
                        Binding="{Binding Path=Firstname}"
                        Header="Firstname"
                        Width="100" />

                    <data:DataGridTextColumn
                        x:Name="lastnameColumn"
                        Binding="{Binding Path=Lastname}"
                        Header="Lastname"
                        Width="100" />

                    <data:DataGridTextColumn
                        x:Name="titleColumn"
                        Binding="{Binding Path=Title}"
                        Header="Title"
                        Width="100" />

                    <data:DataGridTextColumn
                        x:Name="imageUrlColumn"
                        Binding="{Binding Path=ImageUrl}"
                        Header="Image Url"
                        Width="150" />
                    
                    <data:DataGridTextColumn
                        x:Name="imageUrl2Column"
                        Binding="{Binding Path=ImageUrl2}"
                        Header="Image Url 2"
                        Width="150" />

                    <data:DataGridTextColumn
                        x:Name="biographyColumn"
                        Binding="{Binding Path=Biography}"
                        Header="Biography"
                        Width="200" />

                </data:DataGrid.Columns>
            </data:DataGrid>
            <data:DataPager
                Margin="0,0,0,4"
                Name="dataPager1"
                VerticalAlignment="Bottom"
                Grid.ColumnSpan="2"
                DataContext="{Binding ElementName=speakerDomainDataSource, Path=DomainContext.Speakers}" />
            <Grid
                DataContext="{Binding ElementName=speakerDataGrid, Path=SelectedItem}"
                Margin="4,6,8,0"
                x:Name="_detailGrid"
                VerticalAlignment="Top"
                Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition
                        Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition
                        Height="Auto" />
                    <RowDefinition
                        Height="Auto" />
                    <RowDefinition
                        Height="Auto" />
                    <RowDefinition
                        Height="Auto" />
                    <RowDefinition
                        Height="Auto" />
                    <RowDefinition
                        Height="Auto" />
                </Grid.RowDefinitions>

                <TextBlock
                    Grid.Column="0"
                    Grid.Row="0"
                    HorizontalAlignment="Left"
                    Margin="3"
                    Text="Firstname:"
                    VerticalAlignment="Center" />
                <TextBox
                    Grid.Column="1"
                    Grid.Row="0"
                    Height="23"
                    Margin="3"
                    x:Name="firstnameTextBox"
                    Text="{Binding Firstname, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}"
                    VerticalAlignment="Center" />
                <TextBlock
                    Grid.Column="0"
                    Grid.Row="1"
                    HorizontalAlignment="Left"
                    Margin="3"
                    Text="Lastname:"
                    VerticalAlignment="Center" />
                <TextBox
                    Grid.Column="1"
                    Grid.Row="1"
                    Height="23"
                    Margin="3"
                    x:Name="lastnameTextBox"
                    Text="{Binding Lastname, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}"
                    VerticalAlignment="Center" />
                <TextBlock
                    Grid.Column="0"
                    Grid.Row="2"
                    HorizontalAlignment="Left"
                    Margin="3"
                    Text="Title:"
                    VerticalAlignment="Center" />
                <TextBox
                    Grid.Column="1"
                    Grid.Row="2"
                    Height="23"
                    Margin="3"
                    x:Name="titleTextBox"
                    Text="{Binding Title, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}"
                    VerticalAlignment="Center" />
                <TextBlock
                    Grid.Column="0"
                    Grid.Row="3"
                    HorizontalAlignment="Left"
                    Margin="3"
                    Text="Image Url:"
                    VerticalAlignment="Center" />
                <TextBox
                    Grid.Column="1"
                    Grid.Row="3"
                    Height="23"
                    Margin="3"
                    x:Name="imageUrlTextBox"
                    Text="{Binding ImageUrl, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}"
                    VerticalAlignment="Center" />
                <TextBlock
                    Grid.Column="0"
                    Grid.Row="4"
                    HorizontalAlignment="Left"
                    Margin="3"
                    Text="Image Url 2:"
                    VerticalAlignment="Center" />
                <TextBox
                    Grid.Column="1"
                    Grid.Row="4"
                    Height="23"
                    Margin="3"
                    x:Name="imageUrl2TextBox"
                    Text="{Binding ImageUrl2, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}"
                    VerticalAlignment="Center" />
                <TextBlock
                    Grid.Column="0"
                    Grid.Row="5"
                    HorizontalAlignment="Left"
                    Margin="3"
                    Text="Biography:"
                    VerticalAlignment="Top" />
                <TextBox
                    Grid.Column="1"
                    Grid.Row="5"
                    Height="100"
                    Margin="3"
                    x:Name="biographyTextBox"
                    Text="{Binding Biography, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}"
                    VerticalAlignment="Center" TextWrapping="Wrap" />
            </Grid>
            <StackPanel
                Margin="0,8,8,0"
                x:Name="_speakerPanel"
                VerticalAlignment="Top"
                Orientation="Horizontal"
                Grid.Column="1"
                Grid.Row="1"
                d:LayoutOverrides="Width"
                HorizontalAlignment="Right">
                <Button
                    Content="Add Speaker"
                    Name="_add"
                    Click="_add_Click"
                    Margin="4,0" />
                <Button
                    Content="Remove Speaker"
                    Name="_delete"
                    Click="_delete_Click"
                    Margin="4,0" />
            </StackPanel>
            <StackPanel
                x:Name="_changesPanel"
                Margin="0,0,8,8"
                Orientation="Horizontal"
                VerticalAlignment="Bottom"
                Grid.Column="1"
                HorizontalAlignment="Right"
                Grid.Row="1">
                <Button
                    Content="Save Changes"
                    x:Name="_save"
                    Click="_save_Click"
                    Margin="4,0"
                    IsEnabled="{Binding DomainContext.HasChanges, ElementName=speakerDomainDataSource}" />
                <Button
                    Content="Reject Changes"
                    x:Name="_reject"
                    Click="_reject_Click"
                    Margin="4,0"
                    IsEnabled="{Binding DomainContext.HasChanges, ElementName=speakerDomainDataSource}" />
            </StackPanel>

        </Grid>
    </controlsToolkit:BusyIndicator>
</navigation:Page>
